package com.ll.beautymall.ui.home.zero.presenter;

import com.ll.beautymall.bean.ZeroData;
import com.ll.beautymall.bean.ZeroHeader;
import com.ll.beautymall.ui.home.zero.model.OnGetZeroDataLisenter;
import com.ll.beautymall.ui.home.zero.model.OnGetZeroHeaderLisenter;
import com.ll.beautymall.ui.home.zero.model.ZeroBiz;
import com.ll.beautymall.ui.home.zero.view.IZeroView;

import java.util.HashMap;

/**
 * Created by Administrator on 2016/10/25.
 */
public class ZeroPresenter {
    private ZeroBiz zeroBiz;
    private IZeroView zeroView;

    public ZeroPresenter(IZeroView view) {
        zeroView = view;
        zeroBiz = new ZeroBiz();
    }

    public void setZeroHeaderData(HashMap<String, String> parameters) {
        zeroBiz.getZeroHeaderData(parameters, new OnGetZeroHeaderLisenter() {
            @Override
            public void onSucced(ZeroHeader zeroHeader) {
                zeroView.setZeroHeader(zeroHeader);
            }

            @Override
            public void onFailed(String errorMsg) {
                zeroView.showErrorMsg(errorMsg);
            }
        });
    }

    public void setZeroData(HashMap<String, String> parameters) {
        zeroBiz.getZeroData(parameters, new OnGetZeroDataLisenter() {
            @Override
            public void onSucced(ZeroData zeroData) {
                zeroView.setZeroData(zeroData);
            }

            @Override
            public void onFailed(String errorMsg) {
                zeroView.showErrorMsg(errorMsg);
            }
        });
    }


}
